<?php
    include_once("functions_bandwidth.php");
    include_once("datefunctions.php");

    $Start = date("Y/m/") . "1 00:00:00";
  $Start = DateAdd("m", -1, $Start);
  $Start = date("Y/m/d", $Start) . ' 00:00:00' ;
  $Einde = date("Y/m/") . "1 00:00:00";
  $Einde = DateAdd("d", -1, $Einde);
  $Einde = date("Y/m/d", $Einde) . ' 23:59:59';

    $bw2 = func_bw_total_volume_prev_month_day_graph($Start, $Einde);

    //  http://chart.apis.google.com/chart?chxt=y&chxr=0,0,10000&cht=bvs&chd=t:' . $bw2[0][0] . ',' . $bw2[1][0] . ',' . $bw2[2][0] . ',' . $bw2[3][0] . ',' . $bw2[4][0] . ',' . $bw2[5][0] . ',' . $bw2[6][0] . '&chs=700x200&chl='  '&chbh=20,30&chco=4D89F9

print "<chart>";
print "<chart_type>column</chart_type>";
print "<chart_border left_thickness='1' top_thickness='0' bottom_thickness='1' />";
print "<axis_category size='10' />";
print "<axis_value size='10' />";
print "<legend layout='hide' />";
print "<chart_data>
  <row>
	 <null/>
	 <string>" . $bw2[0][1] .  "</string>
	 <string>" . $bw2[1][1] .  "</string>
	 <string>" . $bw2[2][1] .  "</string>
	 <string>" . $bw2[3][1] .  "</string>
     <string>" . $bw2[4][1] .  "</string>
	 <string>" . $bw2[5][1] .  "</string>
	 <string>" . $bw2[6][1] .  "</string>
     <string>" . $bw2[7][1] .  "</string>
	 <string>" . $bw2[8][1] .  "</string>
	 <string>" . $bw2[9][1] .  "</string>
	 <string>" . $bw2[10][1] .  "</string>
     <string>" . $bw2[11][1] .  "</string>
	 <string>" . $bw2[12][1] .  "</string>
	 <string>" . $bw2[13][1] .  "</string>
     <string>" . $bw2[14][1] .  "</string>
	 <string>" . $bw2[15][1] .  "</string>
	 <string>" . $bw2[16][1] .  "</string>
     <string>" . $bw2[17][1] .  "</string>
	 <string>" . $bw2[18][1] .  "</string>
	 <string>" . $bw2[19][1] .  "</string>
	 <string>" . $bw2[20][1] .  "</string>
     <string>" . $bw2[21][1] .  "</string>
	 <string>" . $bw2[22][1] .  "</string>
	 <string>" . $bw2[23][1] .  "</string>
     <string>" . $bw2[24][1] .  "</string>
	 <string>" . $bw2[25][1] .  "</string>
	 <string>" . $bw2[26][1] .  "</string>";

    if($bw2[27][2] == (date("m")) - 1){
        print "<string>" . $bw2[27][1] . "</string>";
    }

    if($bw2[28][2] == (date("m")) - 1){
        print "<string>" . $bw2[28][1] . "</string>";
    }
    
    if($bw2[29][2] == (date("m")) - 1){
        print "<string>" . $bw2[29][1] . "</string>";
    }

    if($bw2[30][2] == (date("m")) - 1){
        print "<string>" . $bw2[30][1] . "</string>";
    }

  print "</row>
  <row>
	 <string>Region A</string>
	 <number>" . $bw2[0][0] . "</number>
     <number>" . $bw2[1][0] . "</number>
	 <number>" . $bw2[2][0] . "</number>
     <number>" . $bw2[3][0] . "</number>
	 <number>" . $bw2[4][0] . "</number>
     <number>" . $bw2[5][0] . "</number>
	 <number>" . $bw2[6][0] . "</number>
     <number>" . $bw2[7][0] . "</number>
	 <number>" . $bw2[8][0] . "</number>
     <number>" . $bw2[9][0] . "</number>
	 <number>" . $bw2[10][0] . "</number>
     <number>" . $bw2[11][0] . "</number>
	 <number>" . $bw2[12][0] . "</number>
     <number>" . $bw2[13][0] . "</number>
	 <number>" . $bw2[14][0] . "</number>
     <number>" . $bw2[15][0] . "</number>
	 <number>" . $bw2[16][0] . "</number>
     <number>" . $bw2[17][0] . "</number>
	 <number>" . $bw2[18][0] . "</number>
     <number>" . $bw2[19][0] . "</number>
	 <number>" . $bw2[20][0] . "</number>
     <number>" . $bw2[21][0] . "</number>
	 <number>" . $bw2[22][0] . "</number>
     <number>" . $bw2[23][0] . "</number>
	 <number>" . $bw2[24][0] . "</number>
     <number>" . $bw2[25][0] . "</number>
	 <number>" . $bw2[26][0] . "</number>
     <number>" . $bw2[27][0] . "</number>";

    if($bw2[28][2] == (date("m")) - 1){
        print "<number>" . $bw2[28][0] . "</number>";
    }

    if($bw2[29][2] == (date("m")) - 1){
        print "<number>" . $bw2[29][0] . "</number>";
    }

    if($bw2[30][2] == (date("m")) - 1){
        print "<number>" . $bw2[30][0] . "</number>";
    }

    if($bw2[31][2] == (date("m")) - 1){
        print "<number>" . $bw2[31][0] . "</number>";
    }

    if($bw2[32][2] == (date("m")) - 1){
        print "<number>" . $bw2[32][0] . "</number>";
    }

print "</row>
</chart_data>";
print "</chart>";
?>
